home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’93 / String Extractor⁄Localization / Scanner / Error.c next >
Text File  |  1993-06-17  |  703b  |  39 lines

  1. /*
  2.  Error.c
  3.  */
  4.  
  5. #include "Error.h"
  6.  
  7.  
  8. void
  9. _Error ( short code , char * file , int line ) {
  10.  
  11. Handle h ;
  12. unsigned char buf [ 32 ] ;
  13. unsigned char fileStr [ 256 ] ;
  14. unsigned char lineStr [ 32 ] ;
  15.  
  16.     if ( code ) {
  17.  
  18.     unsigned char * to = & fileStr [ 1 ] ;
  19.  
  20.         NumToString ( line , lineStr ) ;
  21.         while ( * file ) {
  22.             * ( to ++ ) = ( unsigned char ) * ( file ++ ) ;
  23.         }
  24.         fileStr [ 0 ] = to - fileStr - 1 ;
  25.  
  26.         h = GetResource ( 'Estr' , code ) ;
  27.         if ( h ) {
  28.             HLock ( h ) ;
  29.             ParamText ( ( unsigned char * ) * h , fileStr , lineStr , NULL ) ;
  30.         } else {
  31.             NumToString ( code , buf ) ;
  32.             ParamText ( buf , fileStr , lineStr , NULL ) ;
  33.         }
  34.         if ( 1 == Alert ( 129 , NULL ) ) {
  35.             ExitToShell ( ) ;
  36.         }
  37.     }
  38. }
  39.